home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsITransferable.idl < prev    next >
Text File  |  2006-05-08  |  7KB  |  189 lines

  1. /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is Mozilla Communicator.
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Netscape Communications Corp.
  20.  * Portions created by the Initial Developer are Copyright (C) 1999
  21.  * the Initial Developer. All Rights Reserved.
  22.  *
  23.  * Contributor(s):
  24.  *   Mike Pinkerton
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  28.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39.  
  40. #include "nsISupports.idl"
  41. #include "nsISupportsArray.idl"
  42. #include "nsIFormatConverter.idl"
  43.  
  44.  
  45. %{ C++
  46.  
  47. // these probably shouldn't live here, but in some central repository shared
  48. // by the entire app.
  49. #define kTextMime                   "text/plain"
  50. #define kUnicodeMime                "text/unicode"
  51. #define kHTMLMime                   "text/html"
  52. #define kAOLMailMime                "AOLMAIL"
  53. #define kPNGImageMime               "image/png"
  54. #define kJPEGImageMime              "image/jpg"
  55. #define kGIFImageMime               "image/gif"
  56. #define kFileMime                   "application/x-moz-file"
  57.  
  58. #define kURLMime                    "text/x-moz-url"        // data contains url\ntitle
  59. #define kURLDataMime                "text/x-moz-url-data"   // data contains url only
  60. #define kURLDescriptionMime         "text/x-moz-url-desc"   // data contains description
  61. #define kNativeImageMime            "application/x-moz-nativeimage"
  62. #define kNativeHTMLMime             "application/x-moz-nativehtml"
  63.  
  64. // the source URL for a file promise
  65. #define kFilePromiseURLMime         "application/x-moz-file-promise-url"
  66. // the destination filename for a file promise
  67. #define kFilePromiseDestFilename    "application/x-moz-file-promise-dest-filename"
  68. // a dataless flavor used to interact with the OS during file drags
  69. #define kFilePromiseMime            "application/x-moz-file-promise"
  70. // a synthetic flavor, put into the transferable once we know the destination directory of a file drag
  71. #define kFilePromiseDirectoryMime   "application/x-moz-file-promise-dir"
  72.  
  73. %}
  74.  
  75.  
  76. /**
  77.   * nsIFlavorDataProvider allows a flavor to 'promise' data later,
  78.   * supplying the data lazily.
  79.   * 
  80.   * To use it, call setTransferData, passing the flavor string,
  81.   * a nsIFlavorDataProvider QI'd to nsISupports, and a data size of 0.
  82.   *
  83.   * When someone calls getTransferData later, if the data size is
  84.   * stored as 0, the nsISupports will be QI'd to nsIFlavorDataProvider,
  85.   * and its getFlavorData called.
  86.   *
  87.   */
  88. interface nsITransferable;
  89.  
  90. [scriptable, uuid(7E225E5F-711C-11D7-9FAE-000393636592)]
  91. interface nsIFlavorDataProvider : nsISupports
  92. {
  93.  
  94.   /**
  95.     * Retrieve the data from this data provider.
  96.     *
  97.     * @param  aTransferable (in parameter) the transferable we're being called for.
  98.     * @param  aFlavor (in parameter) the flavor of data to retrieve
  99.     * @param  aData the data. Some variant of class in nsISupportsPrimitives.idl
  100.     * @param  aDataLen the length of the data
  101.     */
  102.   void getFlavorData(in nsITransferable aTransferable, in string aFlavor, out nsISupports aData, out unsigned long aDataLen);
  103. };
  104.  
  105.  
  106. [scriptable, uuid(8B5314BC-DB01-11d2-96CE-0060B0FB9956)]
  107. interface nsITransferable : nsISupports
  108. {
  109.   const long kFlavorHasDataProvider = 0;
  110.   
  111.   /**
  112.     * Computes a list of flavors (mime types as nsISupportsCString) that the transferable 
  113.     * can export, either through intrinsic knowledge or output data converters.
  114.     *
  115.     * @param  aDataFlavorList fills list with supported flavors. This is a copy of
  116.     *          the internal list, so it may be edited w/out affecting the transferable.
  117.     */
  118.   nsISupportsArray flavorsTransferableCanExport ( ) ;
  119.  
  120.   /**
  121.     * Given a flavor retrieve the data. 
  122.     *
  123.     * @param  aFlavor (in parameter) the flavor of data to retrieve
  124.     * @param  aData the data. Some variant of class in nsISupportsPrimitives.idl
  125.     * @param  aDataLen the length of the data
  126.     */
  127.   void getTransferData ( in string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
  128.  
  129.   /**
  130.     * Returns the best flavor in the transferable, given those that have
  131.     * been added to it with |AddFlavor()|
  132.     *
  133.     * @param  aFlavor (out parameter) the flavor of data that was retrieved
  134.     * @param  aData the data. Some variant of class in nsISupportsPrimitives.idl
  135.     * @param  aDataLen the length of the data
  136.     */
  137.   void getAnyTransferData ( out string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
  138.  
  139.   /**
  140.     * Returns true if the data is large.
  141.     */
  142.   boolean isLargeDataSet ( ) ;
  143.   
  144.  
  145.     ///////////////////////////////
  146.     // Setter part of interface 
  147.     ///////////////////////////////
  148.  
  149.   /**
  150.     * Computes a list of flavors (mime types as nsISupportsCString) that the transferable can
  151.     * accept into it, either through intrinsic knowledge or input data converters.
  152.     *
  153.     * @param  outFlavorList fills list with supported flavors. This is a copy of
  154.     *          the internal list, so it may be edited w/out affecting the transferable.
  155.     */
  156.   nsISupportsArray flavorsTransferableCanImport ( ) ;
  157.  
  158.   /**
  159.     * Sets the data in the transferable with the specified flavor. The transferable
  160.     * will maintain its own copy the data, so it is not necessary to do that beforehand.
  161.     *
  162.     * @param  aFlavor the flavor of data that is being set
  163.     * @param  aData the data, some variant of class in nsISupportsPrimitives.idl,
  164.     *         or an nsIFlavorDataProvider (see above)
  165.     * @param  aDataLen the length of the data, or 0 if passing a nsIFlavorDataProvider
  166.     */
  167.   void setTransferData ( in string aFlavor, in nsISupports aData, in unsigned long aDataLen ) ;
  168.  
  169.   /**
  170.     * Add the data flavor, indicating that this transferable 
  171.     * can receive this type of flavor
  172.     *
  173.     * @param  aDataFlavor a new data flavor to handle
  174.     */
  175.   void addDataFlavor ( in string aDataFlavor ) ;
  176.  
  177.   /**
  178.     * Removes the data flavor matching the given one (string compare) and the data
  179.     * that goes along with it.
  180.     *
  181.     * @param  aDataFlavor a data flavor to remove
  182.     */
  183.   void removeDataFlavor ( in string aDataFlavor ) ;
  184.  
  185.   attribute nsIFormatConverter converter;
  186.  
  187. };
  188.  
  189.